package com.ge.healthcare.autosc.common.database.dao;

import java.util.ArrayList;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.ge.healthcare.autosc.common.database.pojo.CfgProDiagsSchedule;



public class CfgProDiagsScheduleDAOImpl extends BaseDAO implements CfgProDiagsScheduleDAO {
	
	
	protected CfgProDiagsScheduleDAOImpl() {
		super(CfgProDiagsSchedule.TABLE_NAME);
	}


	protected Class<CfgProDiagsSchedule> getDataClass() {
		return CfgProDiagsSchedule.class;
	}
	
	
	public void updateSchedule(CfgProDiagsSchedule cfgProDiagsSchedule) {
		super.save(cfgProDiagsSchedule);
	}
	
	public List<CfgProDiagsSchedule> getRequestBySystemID(String systemId) {
		DetachedCriteria dc = DetachedCriteria.forClass(getDataClass());
		List<CfgProDiagsSchedule> actRequestBean = new ArrayList<CfgProDiagsSchedule>();
					dc.add(Restrictions.eq("systemId", systemId));
			
			actRequestBean = (List<CfgProDiagsSchedule>)getHibernateTemplate().findByCriteria(dc);
			System.out.println(actRequestBean.size());
		
		return actRequestBean;
	}
	
	public List<CfgProDiagsSchedule> getRequestByModelType(String modelType){
		DetachedCriteria dc = DetachedCriteria.forClass(getDataClass());
		List<CfgProDiagsSchedule> actRequestBean = new ArrayList<CfgProDiagsSchedule>();
					dc.add(Restrictions.eq("modelType", modelType));
			
			actRequestBean = (List<CfgProDiagsSchedule>)getHibernateTemplate().findByCriteria(dc);
			System.out.println(actRequestBean.size());
		
		return actRequestBean;
	}
	
	public List<CfgProDiagsSchedule> getAllObjects() {
		DetachedCriteria dc = DetachedCriteria.forClass(getDataClass());
		return (List<CfgProDiagsSchedule>)getHibernateTemplate().findByCriteria(dc);
	}
}
